import OrderDetail from './OrderDetail';

const oderDate = new Date(2021, 10, 17, 23, 2, 50, 0);

// 简写类
/**
 * 如果把 public 去掉就是参数 加上就是属性，属性会在原型上面，参数不会在原型上面
 * 下面赋值方式为 隐形赋值
 */
class Orderjx {
	constructor(
		public orderId: number = 0,
		public date: Date,
		public add: string,
		public name: string,
		public phone: string,
		public OrderDetail: Array<OrderDetail>
	) {
		// this.orderId = orderId;
		// this.date = date;
		// this.add = add;
		// this.name = name;
		// this.phone = phone;
		// 因为订单 订单id 日期,客户地址，收货姓名 电话 是订单属性都有，订单内容不一样所有抽离为一个一个类 这个
		// 把商品购买数据赋值给订单
		// this.OrderDetail = OrderDetail;
	}
}

const OrderDetailOne1 = new OrderDetail(111111, '桌子', 100, 1);
const OrderDetailTw02 = new OrderDetail(2222, '椅子', 199, 2);
const oderDate1 = new Date(2021, 10, 17, 23, 2, 50, 0);

const od1 = new Orderjx(1, oderDate, '重庆市', '自夏', '18381104525', [
	OrderDetailOne1,
	OrderDetailTw02,
]);

console.log(od1);
